﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.RBAC
{
    /// <summary>
    /// 权限表
    /// 原实体名: Permissionmodel
    /// 修改后实体名: Permission (保持类名不变以兼容现有代码)
    /// </summary>
    [SugarTable("permissionmodel", TableDescription = "权限表")]
    public class Permissionmodel : BaseEntity
    {
        /// <summary>
        /// 权限编号（唯一标识）
        /// 原字段名: Permissioncode
        /// 修改后字段名: PermissionCode
        /// 用途：用于业务层面的权限唯一标识
        /// </summary>
        [SugarColumn(ColumnDescription = "权限编号", Length = 50, IsNullable = false)]
        public string PermissionCode { set; get; }

        /// <summary>
        /// 权限名称
        /// 原字段名: Permissionname
        /// 修改后字段名: PermissionName
        /// </summary>
        [SugarColumn(ColumnDescription = "权限名称", Length = 100, IsNullable = false)]
        public string PermissionName { get; set; }

        /// <summary>
        /// 权限路径/路由地址
        /// 原字段名: Permissionurl
        /// 修改后字段名: PermissionUrl
        /// 用途：前端路由路径或API接口路径
        /// </summary>
        [SugarColumn(ColumnDescription = "权限路径", Length = 200, IsNullable = true)]
        public string? PermissionUrl { get; set; }

        /// <summary>
        /// 父级权限ID（用于构建权限树形结构）
        /// 原字段名: Parentid
        /// 修改后字段名: ParentId
        /// 说明：0表示顶级权限，否则指向父权限的ID
        /// </summary>
        [SugarColumn(ColumnDescription = "父级权限ID", IsNullable = false)]
        public long ParentId { get; set; } = 0;

        /// <summary>
        /// 权限类型
        /// 新增字段
        /// 用途：区分不同类型的权限，便于权限管理和控制
        /// 1-目录，2-菜单，3-按钮，4-API接口
        /// </summary>
        [SugarColumn(ColumnDescription = "权限类型", IsNullable = false)]
        public int PermissionType { get; set; } = 2;

        /// <summary>
        /// 权限图标
        /// 新增字段
        /// 用途：前端菜单显示的图标，如"el-icon-user"
        /// </summary>
        [SugarColumn(ColumnDescription = "权限图标", Length = 100, IsNullable = true)]
        public string? Icon { get; set; }

        /// <summary>
        /// 排序号（同级权限排序）
        /// 新增字段
        /// 用途：控制权限在列表和树形结构中的显示顺序
        /// </summary>
        [SugarColumn(ColumnDescription = "排序号", IsNullable = false)]
        public int Sort { get; set; } = 0;

        /// <summary>
        /// 权限状态（1-启用，0-禁用）
        /// 新增字段
        /// 用途：支持权限的启用和禁用，禁用后该权限不可使用
        /// </summary>
        [SugarColumn(ColumnDescription = "权限状态", IsNullable = false)]
        public int Status { get; set; } = 1;

        /// <summary>
        /// 权限描述/说明
        /// 新增字段
        /// 用途：详细说明权限的用途和功能
        /// </summary>
        [SugarColumn(ColumnDescription = "权限描述", Length = 500, IsNullable = true)]
        public string? Description { get; set; }


        /// <summary>
        /// 备注信息
        /// 新增字段
        /// 用途：记录其他需要说明的信息
        /// </summary>
        [SugarColumn(ColumnDescription = "备注", Length = 500, IsNullable = true)]
        public string? Remark { get; set; }
    }
}
